package com.contest.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.contest.dao.SysRoleMenuDao;
import com.contest.entity.SysRoleMenu;
import com.contest.service.SysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * ${table.comment}  服务实现类
 * </p>
 *
 * @author yfl
 * @since ${date}
 */
@Service
public class SysRoleMenuServiceImpl extends  ServiceImpl<SysRoleMenuDao, SysRoleMenu> implements SysRoleMenuService {

    @Autowired
    SysRoleMenuDao sysRoleMenuDao;

    public Page<SysRoleMenu> listByPage(Page<SysRoleMenu> page) {
        Integer rows = page.getSize();
        int start = (page.getCurrent()-1)*rows;
        Map<String,Object> param = page.getCondition();
        List<SysRoleMenu> sysRoleMenuList = sysRoleMenuDao.listByPage(start,rows,param);
        int total = sysRoleMenuDao.queryTotal(param);
        Page<SysRoleMenu> menuPage = new Page<SysRoleMenu>();
        menuPage.setRecords(sysRoleMenuList);
        menuPage.setTotal(total);
        return menuPage;
    }
}
